﻿using StructuredProgrammingAssignment.Models.Configurations;
using System.Configuration;

namespace StructuredProgrammingAssignment.App_Start
{
	public class SPConfig : ConfigurationSection
	{
		private static SPConfig settings = ConfigurationManager.GetSection("SPConfig") as SPConfig;

		public static SPConfig Settings {
			get {
				return settings;
			}
		}

		[ConfigurationProperty("allowDynamicQuery", DefaultValue = true)]
		public bool AllowDynamicQuery {
			get { return (bool)this["allowDynamicQuery"]; }
			set { this["allowDynamicQuery"] = value; }
		}

		[ConfigurationProperty("limitCustomProperties", DefaultValue = false)]
		public bool LimitCustomProperties {
			get { return (bool)this["limitCustomProperties"]; }
			set { this["limitCustomProperties"] = value; }
		}

		[System.Configuration.ConfigurationProperty("userAccountProperties")]
		public CustomPropertiesCollection UserAccountProperties {
			get {
				return (CustomPropertiesCollection)this["userAccountProperties"] ??
				   new CustomPropertiesCollection();
			}
		}

		[System.Configuration.ConfigurationProperty("userStuffProperties")]
		public CustomPropertiesCollection UserStuffProperties {
			get {
				return (CustomPropertiesCollection)this["userStuffProperties"] ??
				   new CustomPropertiesCollection();
			}
		}

		[System.Configuration.ConfigurationProperty("categoryProperties")]
		public CustomPropertiesCollection CategoryProperties {
			get {
				return (CustomPropertiesCollection)this["categoryProperties"] ??
				   new CustomPropertiesCollection();
			}
		}

		[System.Configuration.ConfigurationProperty("orderProperties")]
		public CustomPropertiesCollection OrderProperties {
			get {
				return (CustomPropertiesCollection)this["orderProperties"] ??
				   new CustomPropertiesCollection();
			}
		}

		[System.Configuration.ConfigurationProperty("dynamicQuery")]
		public DynamicQueryCollection DynamicQuery {
			get {
				return (DynamicQueryCollection)this["dynamicQuery"] ??
				   new DynamicQueryCollection();
			}
		}

		[System.Configuration.ConfigurationProperty("sensitiveLogParams")]
		public SensitiveLogParamCollection SensitiveLogParams {
			get {
				return (SensitiveLogParamCollection)this["sensitiveLogParams"] ??
				   new SensitiveLogParamCollection();
			}
		}
	}
}